package com.basker.pisces.domain.value;

import com.basker.pisces.domain.value.meta.EnumOption;

public class EnumOptionValue extends EnumOption implements IValueObject {

    public static final EnumOptionValue EMPTY = new EmptyEnumOptionValue();

    public EnumOptionValue(EnumOption option) {
        super(option.getId(), option.getDisplayName());
    }

    private EnumOptionValue() {
        super(null, "");
    }

    @Override
    public Object getDataValue() {
        return this.getId();
    }

    @Override
    public String getPresentValue() {
        return this.getDisplayName();
    }

    @Override
    public boolean isEmpty() {
        return this.getId() == null;
    }

    @Override
    public String toString() {
        return super.toString();
    }

    private static final class EmptyEnumOptionValue extends EnumOptionValue {

        @Override
        public Object getDataValue() {
            return null;
        }

        @Override
        public String getDisplayName() {
            return "";
        }

        @Override
        public String getId() {
            return null;
        }

        @Override
        public String getPresentValue() {
            return "";
        }
    }

}
